import request from "@/utils/request";

/**
 * 租车服务相关API
 */

// 创建租车订单
export const createRental = (data) => request.post(
    "/api/rental/create.do",
    data,
    { headers: { "Content-Type": "application/x-www-form-urlencoded" } }
);

// 获取用户的租车记录
export const getUserRentals = (params) => request.get(
    "/api/rental/userRentals.do",
    { params }
);

// 获取租车订单详情
export const getRentalDetail = (params) => request.get(
    "/api/rental/detail.do",
    { params }
);

// 取消租车订单
export const cancelRental = (data) => request.post(
    "/api/rental/cancel.do",
    data,
    { headers: { "Content-Type": "application/x-www-form-urlencoded" } }
);

// 更新租车订单状态
export const updateRentalStatus = (data) => request.post(
    "/api/rental/updateStatus.do",
    data
);

// 计算租车费用
export const calculateRentalCost = (params) => request.get(
    "/api/rental/calculateCost.do",
    { params }
);

// 检查车辆可租性
export const checkCarAvailability = (params) => request.get(
    "/api/rental/checkAvailability.do",
    { params }
);